Learn R Programming

SpaDES.core (version 2.0.5)

[,simList,character,ANY-method: Extract an intact simList but with subset of objects

Description

This is copies the non-object components of a simList (e.g., events, etc.) then selects only the objects listed in i using Copy(mget(i, envir(sim))) and adds them to the returned simList.

Usage

# S4 method for simList,character,ANY
[(x, i, j, ..., drop = TRUE)

Value

The [ method returns a complete simList class with all the slots copied from the original, but only the named objects in i are returned.

Arguments

x

A simList

i

A character vector of objects to select.

j

Not used.

...

Not used.

drop

Not used.

Author

Eliot McIntire

Examples

Run this code
s <- simInit()
s$a <- 1
s$b <- 2
s$d <- 3
s[c("a", "d")] # a simList with only 2 objects


Run the code above in your browser using DataLab